"""
    Special class-container for user specified values.
"""

from sqlobject.col import UnicodeCol

from mnemoply.model.model_object import ModelObject
from mnemoply.model.hub import __connection__

class Environment(ModelObject):
    """
        Field-specific variables.
    """

    model_title = _("Environment")

    name = UnicodeCol(length=50, notNull=True, alternateID=True, title=_("Name"))
    value = UnicodeCol(default=None, title=_("Value"))
    comment = UnicodeCol(default=None, title=_("Comment"))

    @classmethod
    def getValue(cls, name):
        try: 
            return cls.byName(name).value
        except:
            return None

    title = property(lambda self: self.name)
